# 定义
dict1 = {}  # 空字典
dict2 = dict()  # 空字典
 
dict3 = {'ID':'154687131348','age':18,'name':'wyj'}
print(dict3)

dict4 = dict([(1,2),(3,4),(5,6)])
print(dict4)

# 当出现键一样的时候，后面的值回覆盖前面的值
dict5 = dict([(1,2),(3,4),(3,6)])
print(dict5)


# 没有成对出现会报错，键值对不匹配
# dict6 = dict([(1,2,3),(4,5)])
# print(dict6)

print('\n\n')
dict7 = {}
dict7['brand'] = 'huawei'
print(dict7)
dict7['brand'] = 'mi'
dict7['type'] = 'p30 pro'
dict7['price'] = 9000
dict7['color'] = 'black'
print(dict7)

# 案例
'''
用户注册功能
username
password
email
phone
'''
print('------------欢迎来到智联招聘用户注册---------')
database = []
while True:
	username = input('输入用户名：')
	password = input('输入密码：')
	repassword = input('输入确认密码：')
	email = input('输入邮箱：')
	phone = input('输入手机号：')
	
	# 定义一个字典
	user = {}
	# 将信息保存到字典中
	user['username'] = username
	if password == repassword:
		user['password'] == password
	else:
		print('两次输入的密码不一致！重新输入')
		continue

	user['email'] = email
	user['phone'] = phone
	
	database.append(user)
	answer = input('是否继续注册？(y/n)')
	if answer != 'y':
		break
	